package cn.wolfcode.luowowo.util;

import lombok.Getter;

@Getter
public enum RedisKeys {
    LOGIN_TOKEN("login_token",Consts.VERIFY_CODE_VAI_TIME * 60L),
    VERIFY_CODE("verify_code",Consts.VERIFY_CODE_VAI_TIME * 60L);

    private String prefix;//key前缀
    private Long time;//key有效时间

    private RedisKeys(String prefix,Long time){
        this.prefix = prefix;
        this.time = time;
    }
    //拼接真实的key
    public String join(String...value){
        StringBuilder sb = new StringBuilder(80);
        sb.append(this.prefix);
        for(String s :value){
            sb.append(":").append(s);
            return sb.toString();
        }
        return this.prefix + ":" + value;
    }
}
